#pragma once
#include "TShader.h"

struct TLightAndMaterial
{
	D3DXVECTOR4			m_vAmbientMaterialColor;
};
struct cbChangesEveryFrame
{
	ID3D10EffectMatrixVariable*	cb_matView;  
	ID3D10EffectScalarVariable*	cb_fTimer;
};
struct cbNeverChanges
{
	ID3D10EffectVectorVariable*			cb_GlobalAmbientLightColor;
};
struct cbChangeOnResize
{
	ID3D10EffectMatrixVariable*	cb_matProj;
};

class TEffectPool: public TSingleton < TEffectPool >
{
private:
	friend class TSingleton<TEffectPool>;
public:
	TCHAR_STRING		m_strEffectPool;
	TShader*			m_pShader;
	ID3D10EffectPool*	m_pEffectPool;
	ID3D10EffectPool*	GetEffectPool() { return m_pEffectPool;}

	HRESULT				Create(TCHAR* strFileName =0);
public:
	ID3D10EffectConstantBuffer* m_pCbNeverChanges;
	ID3D10EffectConstantBuffer* m_pCbChangesEveryFrame;
	ID3D10EffectConstantBuffer* m_pCbChangeOnResize;
	
	cbChangesEveryFrame			m_cbChangesEveryFrame;	
	cbNeverChanges				m_cbNeverChanges;	
	cbChangeOnResize			m_cbChangeOnResize;
	TLightAndMaterial			m_LightAadMaterial;
public:
	D3DXMATRIX*			m_pmatWorld;
	D3DXMATRIX*			m_pmatView;
	D3DXMATRIX*			m_pmatProj;	
	float				m_fTimer;

public:	
	bool				Init();
	void				SetMatrix( D3DXMATRIX* pWorld, D3DXMATRIX* pView, D3DXMATRIX* pProj );
	void				Update(	float fTimer );	
	void				SetChangeOnResize();
	void				SetNeverChange();

public:
	TEffectPool(void);
	virtual ~TEffectPool(void);
};
#define I_EffectPool TEffectPool::GetInstance()